#pragma once
#include <iostream>
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
using namespace std;
class InetAddr
{
    public:
InetAddr(const struct sockaddr_in & addr):_addr(addr)
{
_port=ntohs(addr.sin_port);
ipname=inet_ntoa(_addr.sin_addr);
}
string Ip()
{
    return ipname;
}
uint16_t Port()
{
    return _port;
}
string PrintDebug()
{
    string buffer=ipname;
    buffer+=";";
    buffer+=to_string(_port);
    return buffer;
}
~InetAddr()
{

}
private:
string ipname;
uint16_t _port;
struct sockaddr_in _addr;
};